//////////////////////////////////////////////////////////////////////////
//
// Render Window
// RenderWindow.cpp
// 
// Grant Johnson
// Qantm College
// 27/10/2010
//
//////////////////////////////////////////////////////////////////////////

#include "RenderWindow.h"
#include "MainWindow.h"
#include "GUIWindow.h"
#include "HGEWindow.h"
#include <commctrl.h>

#define WINDOW_CLASS_NAME	"Main Window"
#define GUI_CLASS_NAME	"GUI Window"
#define HGE_CLASS_NAME	"HGE Window"

RenderWindow::RenderWindow()
{
	m_pMainWindow = new MainWindow();
	m_pGUIWindow = new GUIWindow();
	m_pHGEWindow = new HGEWindow();
}
RenderWindow::~RenderWindow()
{
	if(m_pMainWindow)
	{
		delete m_pMainWindow;
		m_pMainWindow = NULL;
	}
	if(m_pGUIWindow)
	{
		delete m_pGUIWindow;
		m_pGUIWindow = NULL;
	}
	if(m_pHGEWindow)
	{
		delete m_pHGEWindow;
		m_pHGEWindow = NULL;
	}
}

bool RenderWindow::Setup(char* a_windowName, int a_width, int a_height, HINSTANCE a_hInst)
{
	InitCommonControls();

	//Create the main window
	m_pMainWindow->Setup(NULL, a_hInst, 100, 100, a_width, a_height, a_windowName, WINDOW_CLASS_NAME, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN);
	
	//Create the sub windows
	//m_pGUIWindow->Setup(m_pMainWindow->GetWindow(), a_hInst, 0, 0, 200, 600, NULL, GUI_CLASS_NAME, WS_CHILDWINDOW);
	m_pHGEWindow->Setup(m_pMainWindow->GetWindow(), a_hInst, 200, 0, 600, 600, NULL, HGE_CLASS_NAME, WS_CHILDWINDOW);
	
	return true;
}

void RenderWindow::Update()
{
	m_pMainWindow->Update();
	//m_pGUIWindow->Update();
	m_pHGEWindow->Update();
}
float RenderWindow::GetDeltaTime()
{
	return m_timer.GetFrameTime();
}